Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

reverse array in c

//reverse char array in c
void reverse(char array[]){
	int size = strlen(array); //include string.h to use strlen()
  	char rev[size];
  
  	for(int i=0; i<size; i++)
   		rev[size-1-i] = array[i]; 
      
	for(int i=0; i<size; i++)
    	array[i] = rev[i];
}
 
PREVIOUS NEXT
Tagged: #reverse #array
ADD COMMENT
Topic
Name
9+6 =