Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pointer arithmetic in C
#1
Pointers can be manipulated using arithmetic operations.

int numbers[] = {10, 20, 30, 40, 50};
int *ptr = numbers;

printf("%d\n", *ptr); // Output: 10
ptr++; // Move the pointer to the next element
printf("%d\n", *ptr); // Output: 20
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Basic arithmetic operations with the double datatype in C Qomplainerz 0 380 07-26-2023, 06:01 PM
Last Post: Qomplainerz
  Arithmetic operations with short int in C Qomplainerz 0 405 07-26-2023, 03:46 PM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 1 Guest(s)