Top

Discussion

Output of following program

#include  
int fun(char *p) 
{ 
    if (p == NULL || *p == '\0') return 0; 
    int current = 1, i = 1; 
    while (*(p+current)) 
    { 
        if (p[current] != p[current-1]) 
        { 
            p[i] = p[current]; 
            i++; 
        } 
        current++; 
    } 
    *(p+i)='\0'; 
    return i; 
} 
  
int main() 
{ 
    char str[] = "geeksskeeg"; 
    fun(str); 
    puts(str); 
    return 0; 
} 

 

  • A.gekskeg
  • B.geeksskeeg
  • C.geeks
  • D.Garbage Values

Answer: A

No answer description available for this question.
 

No comment is present. Be the first to comment.
Loading…

Post your comment