accessing elements of 1d array using pointers
C
#include<stdio.h>
int main(){
int arr[] = {1,3,4,5,6,7,8};
int *ptr = &arr; //storing address of the first element in array in the ptr
//accessing the elements of the array using ptr
for(int i=0;i<7;i++)
printf("%d ",*(ptr+i));
//here i represents the value to be added to the base address
return 0;
}
Also in C:
- Title
- write array of char to file in c
- Category
- C
- Title
- chat c socket tcp geeksforgeeks
- Category
- C
- Title
- ImportError: No module named 'skimage'
- Category
- C
- Title
- how to check the size of a file in linux c
- Category
- C
- Title
- declare variable in c
- Category
- C
- Title
- ordenar un vector
- Category
- C
- Title
- scanf read line
- Category
- C
- Title
- pasar a binario recursivo
- Category
- C
- Title
- c isdigit function
- Category
- C
- Title
- arduino knn
- Category
- C
- Title
- how to globally initlailize a struct
- Category
- C
- Title
- turn a char array into double C
- Category
- C
- Title
- jock cranley
- Category
- C
- Title
- get a remote branch git
- Category
- C
- Title
- error: ‘cout’ was not declared in this scope
- Category
- C
- Title
- printf in c
- Category
- C
- Title
- c print array
- Category
- C
- Title
- pointer parameter where to put the asterix in C?
- Category
- C
- Title
- CL/cl.h: No such file or directory
- Category
- C
- Title
- how to download file in powershell
- Category
- C
- Title
- pass the pointer in C
- Category
- C
- Title
- passing 2d array as parameter to function in c
- Category
- C
- Title
- docker images command
- Category
- C
- Title
- write a program to ask the user 8 integer numbers. your program will then move all negative elements of your array to the end of the array without changing the order of positive elements and negative elements
- Category
- C
- Title
- potencia recursiva
- Category
- C
- Title
- tar cmd
- Category
- C
- Title
- confirm sweet alert
- Category
- C
- Title
- how to declare 2 d array using malloc
- Category
- C
- Title
- Declare macro
- Category
- C
- Title
- kadane's algorithm
- Category
- C
- Title
- powershell search big files
- Category
- C
- Title
- append to list in c
- Category
- C
- Title
- c bit access struct
- Category
- C
- Title
- piramide
- Category
- C
- Title
- declare character array statically?
- Category
- C
- Title
- add border to image android
- Category
- C
- Title
- diferencia entre * y & en c
- Category
- C
- Title
- iterar en map
- Category
- C
- Title
- what is size_t in c
- Category
- C
- Title
- xmlns='' was not expected
- Category
- C
- Title
- c concatenate strings
- Category
- C
- Title
- arduino digital input pins
- Category
- C
- Title
- how to create an array of char in c++
- Category
- C
- Title
- strcat in c
- Category
- C
- Title
- printf n characters c
- Category
- C
- Title
- lazer codechef
- Category
- C
- Title
- c bitwise operators
- Category
- C
- Title
- vbnet create and write on file
- Category
- C
- Title
- for loop in c
- Category
- C
- Title
- múltiplos entre dos numeros en c
- Category
- C
- Title
- how to use ? in c
- Category
- C
- Title
- what is a long long int in c
- Category
- C
- Title
- c producer consumer pthread semaphore
- Category
- C
- Title
- ModuleNotFoundError: No module named 'tensorboardX'
- Category
- C
- Title
- array length c
- Category
- C
- Title
- how to print the address of a pointer in c
- Category
- C
- Title
- -> operator
- Category
- C
- Title
- functions return type in c
- Category
- C
- Title
- hentai clochette
- Category
- C
- Title
- vbl share price
- Category
- C
- Title
- typedef vs #define
- Category
- C
- Title
- coin row problem in linear time
- Category
- C
- Title
- how to write function in c
- Category
- C
- Title
- passing 'const char *' to parameter of type 'char *' discards qualifiers
- Category
- C
- Title
- es fibo
- Category
- C
- Title
- How to pull images from Docker Registry
- Category
- C
- Title
- how to free memory in c
- Category
- C
- Title
- oop244
- Category
- C
- Title
- convert string to float c
- Category
- C
- Title
- use of matplotlib inline
- Category
- C
- Title
- C/c drop mime
- Category
- C
- Title
- what are the causes of memory leaks in c
- Category
- C
- Title
- qtableview get selected row
- Category
- C
- Title
- xamarin command listview button
- Category
- C
- Title
- classification report to excel
- Category
- C
- Title
- how to rebasde
- Category
- C
- Title
- resto de division recursiva
- Category
- C
- Title
- latex font sizes
- Category
- C
- Title
- inurl:fiu.edu math faculty
- Category
- C
- Title
- how to change the mapping from jkil to wasd in vim
- Category
- C
- Title
- function pointer c
- Category
- C
- Title
- windowns 10 allow ping
- Category
- C
- Title
- es vocal
- Category
- C
- Title
- print variable c
- Category
- C
- Title
- strrev in c
- Category
- C
- Title
- delete docker image repository none
- Category
- C
- Title
- \0 in c
- Category
- C
- Title
- download android ndk r 16
- Category
- C
- Title
- debian install npm
- Category
- C
- Title
- c get first n characters of string
- Category
- C
- Title
- pop and push shows black screen which needs to be pressed back flutter
- Category
- C
- Title
- print integer to stdout using write or putchar?
- Category
- C
- Title
- factors using recursion
- Category
- C
- Title
- multiplication operator in c
- Category
- C
- Title
- typedef in c
- Category
- C
- Title
- how to remove \n from a string c
- Category
- C
- Title
- wait function in c
- Category
- C
- Title
- router solicitation and advertisement magic is used by
- Category
- C
- Title
- restapi
- Category
- C
- Title
- c vs python
- Category
- C