Answers for "revers array in c"

C
1

revers array in c

//reverse char array in c
void reverse(char array[]){
	int size = strlen(array); //include string.h to use strlen() function
  	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];
}
Posted by: Guest on April-30-2022

Code answers related to "C"

Browse Popular Code Answers by Language