3i Infotech Papers: Sample Questions 377 - 379 of 1245

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 377

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

Predict the output or error (s) for the following:

  1. #include<stdio.h>
  2. main ()
  3. {
  4.     char *str = “hello”;
  5.     char *ptr = str;
  6.     char least = 127;
  7.     while (*ptr++)
  8.     least = *ptr;
  9.     printf ( “%d”,least);
  10. }

Explanation

In the program

Table shows the program

Table shows the program

char * str = “hello”;

  • Define character pointer str = hello

char * ptr = str;

  • After ‘ptr’ reches the end of the string the value pointed by ‘str’ is ‘