| Statements
|
Fortran
(77) |
C |
Remarks |
||||||||
| Structure
(1) |
Col. 1 : c or * for comments |
Structure Free Statement ends with ; Case sensitive |
|||||||||
| Variable
types |
integer, real,double, character |
int,float, double, char |
|
||||||||
| Var
Declaration |
integer a,b,c real x,y |
int a,b,c; real x,y ; |
|||||||||
| Innitialization |
real x,y integer a,b data x/1.2/, a/12/ |
float x=1.2,y int a=12,b; |
|||||||||
| Oporators
(mathematical) |
+,-, *, /, ** |
+,-,*, /, %, ++,-- +=, -= ,*= ,/= |
|||||||||
| Oporators (logical) | .ge. , .gt. , .eq. , .or. ,
.and., .ne, .not. |
>, >= , ==, ||,
&&, !=, ! |
|||||||||
| Control
transfer |
|
|
goto is usually not
used in C. The label there can be anything |
||||||||
| Array |
real a(5), b(5,10) int c(2), k data k/1/, c/19,45/ |
float a[5], b[5][5] int c[]={19,45}, k |
Array Index F : 1 to N C: 0 to N-1 |
||||||||
| Function |
real function add(m,t) |
float mult(int m, float t) { return(t*m);} |
|||||||||
| Subroutine |
subroutine iswap (a, b) |
void iswap(a,b) {int a,b,t; t=a;a=b;b=t} |
Subroutine is a void function in
C. |
||||||||
| A
complete program |
c ----- Butterfly diagram----- |
#include<stdio.h> |
|||||||||
| Files |