1). Function name mentioned before main function is called a) Function Declarati
ID: 3688166 • Letter: 1
Question
1). Function name mentioned before main function is called
a) Function Declaration
b) Function call
c) Function definition
2). Function name mentioned inside the main function is called
a) Function Declaration
b) Function call
c) Function definition
3). Function code with the details of what the function does is mentioned in
a) Function Declaration
b) Function call
c) Function definition
4) int foo(void); - In this function declaration, the keyword 'int' is called
a) Function type
b) Return type
c) Variable type
5) Given the following code:
int x=5 //The memory address of
x=0x54 int
*p=&x; //The memory address of
p=0x50
int y = 0;
int *q=&y; *q=*p; What is the output of the below:
printf("*p=%i ", *p);
printf("x=%i ", x);
printf("p=%i ", p);
printf("&p=%i ", &p);
printf("&x=%i ", &x);
printf("y=%i ", y);
6) Write a program to swap 2 numbers using pointers
7) Write a program to scan a name from user and return its length.
Explanation / Answer
1) function name mentioned before main function is called function declaration.
2)function name mentioned inside the main function is called function calling.
3)function code with the details of what function do is called function definition.
4) int foo(void);
in this function declaration, the int is called the return type. i.e., the data type of the value to be return from the function.
5)*p=5
x=5
p=0x54
&p= // address of p but we used %i so there can be out of range
&x=0x54
and for the last statement there will be execution error.
6)
#include<stdio.h>
#include<conio.h>
void main()
{
int *p,*q;
printf("enter the values");
scanf("%d%d",p,q);
int temp=0;
temp=*p;
*p=*q;
*q=temp;
printf("values are swapped");
getch();
}
7)void main()
{
char name[100];
printf("enter the name");
scanf("%s",&name);
int len=0;
while(name[len]!='')
len++;
printf("length is %d",len);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.