Skip to content

Tag Archives: C-Pointers

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
Consider the below program.   C int main( ) {   int arr[2] = {0,1};   printf("First Element = %d\n",arr[0]);   getchar();   return 0; } C++ // C++… Read More
Most of the time, pointer and array accesses can be treated as acting the same, the major exceptions being:  1) the sizeof operator o sizeof(array) returns… Read More
In C, array parameters are treated as pointers mainly to, To increase the efficiency of code To save time It is inefficient to copy the… Read More
Well, we assume that you know what does it mean by pointer in C. So how do we create a pointer to an integer in… Read More
Predict the output of below program #include<stdio.h> int main() {  char *ptr = "geeksforgeeks";  printf("%c\n", *&*&*ptr);      getchar();  return 0; } Output: g Explanation: The… Read More

Start Your Coding Journey Now!