Given two arrays arr1[] and arr2[] sorted in ascending order and an integer K. The task is to find k pairs with the smallest sums… Read More
Tag Archives: Pointers
Pointers store address of variables or a memory location. // General syntax datatype *var_name; // An example pointer "ptr" that holds // address of… Read More
Predict the output of following program #include<stdio.h> int main() { int a = 12; void *ptr = (int *)&a; printf("%d", *ptr); getchar(); return 0; }… Read More
int f(int x, int *py, int **ppz) { int y, z; **ppz += 1; z = **ppz; *py += 2; y = *py; x +=… Read More
Consider this C code to swap two integers and these five statements after it: void swap(int *px, int *py) { *px = *px - *py; … Read More
#include<stdio.h> void f(int *p, int *q) { p = q; *p = 2; } int i = 0, j = 1; int main() { f(&i,… Read More
The reason for using pointers in a Cprogram is (A) Pointers allow different functions to share and modify their local variables. (B) To pass large… Read More
#include<stdio.h> int main() { int a; char *x; x = (char *) &a; a = 512; x[0] = 1; x[1] = 2; printf("%d\n",a); return 0; … Read More
#include<stdio.h> int main() { int arr[] = {10, 20, 30, 40, 50, 60}; int *ptr1 = arr; int *ptr2 = arr + 5; printf("Number of… Read More
Consider a compiler where int takes 4 bytes, char takes 1 byte and pointer takes 4 bytes. #include <stdio.h> int main() { int arri[]… Read More
Output of following program? #include <stdio.h> int main() { int *ptr; int x; ptr = &x; *ptr = 0; printf(" x =… Read More
Output of following program? # include <stdio.h> void fun(int *ptr) { *ptr = 30; } int main() { int y = 20; fun(&y); printf("%d",… Read More
What is the output of following program? # include <stdio.h> void fun(int x) { x = 30; } int main() { int y =… Read More