1). Function name mentioned before main function is called a) Function Declarati
ID: 3759385 • 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
Function Declaration
Function call
Function definition
Return type
*p=5
x=5
p=2293316
&p=2293304
&x=2293316
y=5
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int a = 5,b = 6;
int *p = &a,*q = &b;
int temp ;
temp = *p;
*p = *q;
*q = temp;
printf("a = %d ",a);
printf("b = %d",b);
}
#include<iostream>
#include<string>
using namespace std;
int main(void) {
string name;
cout << "Enter a name : ";
cin >> name;
cout << "String length is : " << name.length();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.