What will be the output of the below C program.
Practice Variable Number of Arguments – What will be the output of the below C program.
#include
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
return 0;
}
Practice Variable Number of Arguments – What will be the output of the below C program.
#include
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
return 0;
}
Practice Variable Number of Arguments – What will be output of the following “c” code?
Note: 32 bit compiler
#include
int main(){
float **(*ptr)[4]=(float **(*)[4])0;
ptr+=5;
printf("%d %d",ptr,sizeof ptr);
return 0;
}
Practice Variable Number of Arguments – What will be output of the following “c” code?
#include
int main()
{
float i, j;
scanf(%f %f, &i, &j);
printf(%.2f %.3f, i, j);
return 0;
}
What will be the output for the give input 12.342 and 123.4568
#include<stdio.h>
#include
Practice Variable Number of Arguments –
#include<stdio.h>
#include<stdarg.h>
void varfun(int n, ...);
int main() {
varfun(3, 7, -11.2, 0.66);
return 0;
}
void varfun(int n, ...) {
float ptr;
int num;
va_start(ptr, n);
num = va_arg(ptr, int);
printf("%d", num);
}
A function that receives variable number of arguments should use
Practice Variable Number of Arguments –
A function that receives variable number of arguments should use va_arg() to extract the last argument from the variable argument list.