Vous êtes sur la page 1sur 2

Step 1: int i=3, j=4, k, l; The variables i, j, k, l are declared as an integer type and variable i, j are initialized to 3, 4 respectively.

The function addmult(i, j); accept 2 integer parameters. Step 2: k = addmult(i, j); becomes k = addmult(3, 4) In the function addmult(). The variable kk, ll are declared as an integer type i nt kk, ll; kk = ii + jj; becomes kk = 3 + 4 Now the kk value is '7'. ll = ii * jj; becomes ll = 3 * 4 Now the ll value is '12'. return (kk, ll); It returns the value of variable ll only. The value 12 is stored in variable 'k'. Step 3: l = addmult(i, j); becomes l = addmult(3, 4) kk = ii + jj; becomes kk = 3 + 4 Now the kk value is '7'. ll = ii * jj; becomes ll = 3 * 4 Now the ll value is '12'. return (kk, ll); It returns the value of variable ll only. The value 12 is stored in variable 'l'. Step 4: printf("%d, %d\n", k, l); It prints the value of k and l Hence the output is "12, 12". int *check(static int i, static int j)--cannot use static for function parameters

int main() { char huge *near *far *ptr1; char near *far *huge *ptr2; char far *huge *near *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; } 4, 4, 2

It is necessary to call the macro va_end if va_start is called in the function.----YES

#include<stdio.h> int fun(int **ptr); int main() { int i=10; const int *ptr = &i; fun(&ptr); return 0; } int fun(int **ptr) { int j = 223; int *temp = &j; printf("Before changing ptr = %5x\n", *ptr); const *ptr = temp; printf("After changing ptr = %5x\n", *ptr); return 0; } Error: cannot convert parameter 1 from 'const int **' to 'int **' int main() { unsigned int num; int i; scanf("%u", &num); for(i=0; i<16; i++) { printf("%d", (num<<i & 1<<15)?1:0); } return 0; }gives binary value Here, EOF is -1. As 'ch' is declared as unsigned char it cannot deal with any ne gative value. printf("%u %s\n", &"Hello1", &"Hello2"); In printf("%u %s\n", &"Hello", &"Hello");. The %u format specifier tells the compiler to print the memory address of the "H ello1". The %s format specifier tells the compiler to print the string "Hello2". Hence the output of the program is "1022 Hello2".

The function printf() returns the number of charecters printed on the console.

Vous aimerez peut-être aussi