Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how java programming differ from pascal and C
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


stan
how java programming differ from pascal and C
1 Answer(s)      5 years and 11 months ago
Posted in : Java Beginners



Advertisement
View Answers

December 30, 2008 at 3:26 AM


Hi friend,


C and Pascal are both arguably descendants of the ALGOL programming language series. ALGOL introduced so-called "structured programming", where programs were constructed of single entry-single exit "components" such as "if", "while", "for", "case", etc. Also, whereas before ALGOL only the expression syntax for languages was described systematically,


In Pascal, routines that return a value are called functions, and routines that don't return a value are called procedures. In C all routines are called functions, however routines that do not return a value are declared to return "void", meaning that they do not return anything. Actually "void" is not really a valid variable type, it can only be used when declaring the return type of a function. It cannot be used for declaring normal variables of this type,



The statements used between C and Pascal are roughly analogous. if (x) ... else ... while (x) ... do ... while (x) ... switch (x) { case a: ...; case b: ...; default: } if x then ... else ... while x do ... repeat ... until x case x of a: ...; b: ... end Pascal, in its original form, did not have an equivalent version of "default" case (this is a common extension). C has so called "early out" statements "break" and "continue". Pascal does not.


Using the preceeding rules, here is an example of a C function with no return value, and its Pascal equivalent procedure.
//1

void myProc( long myFirstParam, char mySecondParam )
{
/* Here we have some code that does something */
}

Now the Pascal version:

{ 10 }

procedure myProc(myFirstParam: LONGINT, mySecondParam: CHAR);
BEGIN
(* Here we have some code that does something *)
END;

Pascal returns its function values by assigning a value to the function name. C returns a value by using its return statement. Here is an example of a C function that takes no parameters and that returns a double precision floating point value, and then its Pascal equivalent:

/* 11 */

// C version

double myFunc(void){
return 3.14;
}

{12}

function myFunc : DOUBLE; (* Pascal Version *)
BEGIN
myFunc := 3.14
END;
-------------------------------------

Thanks


Related Tutorials/Questions & Answers:
how java programming differ from pascal and C - Java Beginners
how java programming differ from pascal and C  how Does the Java programming language differs from Procedural languages such as Pascal and C.when ýt... and Pascal are both arguably descendants of the ALGOL programming language series. ALGOL
Servlets differ from RMI
Servlets differ from RMI  Explain how servlets differ from RMI. Explain the advantages and disadvantages of each technology ?   RMI (Remote Method Invocation) are a means of client server communication
Advertisements
C Print Pascal Triangle
C Print Pascal Triangle In this section, you will learn how to display Pascal's triangle. A Pascal's triangle is a geometric arrangement of the binomial coefficients in a triangle.The rows of Pascal's triangle are conventionally
C Program to Print Pascal Triangle - Development process
C Program to Print Pascal Triangle  I want C Program to Print Pascal Triangle.  Hi Friend, Try the following code: #include #include void main(){ int a[15][15],i,j,rows,num=25,k; printf("\n enter
how to read from dictionary c
how to read from dictionary c  how to read elements from dictionary in c programming
c programming language - Java Beginners
c programming language  int main() { int i = 1, c = 0, sum = 1,j ; scanf("%d", &j); while (i <= j) { sum = sum + (i /3+i/5); printf("%d
C++ programming language - Java Beginners
C++ programming language  int main() { int i = 1, c = 0, sum = 1,j ; scanf("%d", &j); while (i <= j) { sum = sum + (i /3+i/5); printf
C Programming
C Programming  hi,how can i write a program in C programming to place reservation in air plane from the menu let the user to inter his/her gender(W or M)and draw seats by using ascii codes and choose where he/she will sit
pascal triangle
the following link: C Pascal's Triangle Thanks...pascal triangle   given string : char str[]="123456789"; write a program in 'c'-language that displays the following: 1 232
c programming
c programming  how can i get the ouput in the format of a a b a b c
c programming
c programming  how can i get the ouput in the format of a a b a b c
c programming
c programming  how can i get the ouput in the format of a a b a b c
programming c#
programming c#   create and make use of at least one class with appropriate instance methods to solve the programming problem. use console-based menus to navigate between the functionality offered by the application. at least one
c programming
c programming  write a program to input five numbers by using while loop in c programing
C programming
C programming  i am beginner in C my text book says getchar() and putchar() reads single character at a time and print single character respectively...) { int c; while((c=getchar())!=EOF) { putchar(c); return 0; } i
c programming
c programming  Write a Program in 'C' to print the following output 'n' rows. for example, if n:3, the following should be output by the program : 1 1 2 L r 2 3 2 1 1 2 L 1
c programming
c programming  Write a Program in 'C' to print the following output 'n' rows. for example, if n:3, the following should be output by the program : 1 1 2 L r 2 3 2 1 1 2 L 1
Difference between C++ and Java
Java and C++ are Object Oriented Programming (OOPs) language. Java is derived from C++ , hence both has many similarities. C++ is considered more... programming and extends the C programming language. Java supports network computing
How to access data yearly from DB in C# ?
How to access data yearly from DB in C# ?  how to access data yearly from database in C#. I have code but i m not able to retrieve data yearly from... as Student_ID,payment FROM fee" + ses + " where date1='" + date1
Java vs C
Java vs. C Language In this section we will compare Java and C Programming... business problem. Java is object oriented, platform independent programming language... programming language while c is procedural language Platform independence
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?  i have multiple(app..100) text... column value that keeps on changing for every file.i have read the data from all
How a beginner can start Java Programming?
How a beginner can start Java Programming?  I Just have programming knowledge of C & C++. Let's know how I can learn Java? Is there any Java... have programming language of C and C++ then you can learn Java programming
C/C++ Programming Books
C/C++ Programming Books      ... for Visual C++ 6 programming. This book skips the beginning level material and jumps....     C++ GUI Programming
C Programming SubString Program
C Programming SubString Program  Sir I want to Check whether the Single Substring is present in the given 3 string. characters. eg if i entered First String- CPROGRAMMING Second String- CPROGRAM third String- PROGRAMMING if i
how to convert Visual c++ to java - Java Beginners
how to convert Visual c++ to java  Hi Sakthi here.. How to convert Visual c++ codings to Java codings.. Does both have any similarity in library files
how to use marathi keyboard in java programming?
how to use marathi keyboard in java programming?  how to use Marathi keyboard in java programming
How to write in Binary file in Java programming language
How to write in Binary file in Java programming language  I need some help about Java programming. Please explain me "How to write in Binary file in Java programming language
c programming - Development process
c programming  Hello Sir, can you plz post an answer to these quesions : Write a program in c that prompts the user the name of a file... in c to create a fle, open it, type in some characters and count the number
hi need help with C++ programming!
hi need help with C++ programming!  how do i : b. Store numbers / characters into the file (output) c. Retrieve numbers / characters from the file...; "Unable to open file"; return 0; } c) #include <iostream> #include <
Learning Java Programming for Beginners
Java is an Object Oriented Programming Language that was developed by Sun Microsystems. It is based on C, C++ programming language but a tad better.... There are several ways by which a young developer can learn Java programming, one
How to download java software for Java Programming
How to download java software for Java Programming  Hi, How to download java software for Java Programming? I have purchased a computer.... Please see the thread How to download Java. Thanks
 

 

 

DMCA.com