top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is pascal and cdecl keyword in c language?

+3 votes
2,442 views
What is pascal and cdecl keyword in c language?
posted Jan 21, 2014 by Prachi Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

There are two types of parameters passing conventions in c:

  1. pascal: In this style function name should (not necessary ) in the uppercase .First parameter of function call is passed to the first parameter of function definition and so on.

  2. cdecl: In this style function name can be both in the upper case or lower case. First parameter of function call is passed to the last parameter of function definition. It is default parameter passing convention.

Please get below Examples to get more clarification:

#include<stdio.h>
int main(){
static int a=25;
void cdecl conv1() ;
void pascal conv2();
conv1(a);
conv2(a);
return 0;
}
void cdecl conv1(int a,int b){
printf("%d %d",a,b);
}
void pascal conv2(int a,int b){
printf("\n%d %d",a,b);
}

Output: 25 0
0 25
answer Jan 21, 2014 by Amit Kumar Pandey
unable to execute
how does it works? i cant get it!!
...