A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C program to change string to upper case without strupr
Q:

C program to change string to upper case without strupr

0

C program to change string to upper case without strupr.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

I have used Code:: Blocks compiler for debugging purpose. But you can use any C programming language compiler as per your availability.

#include <stdio.h>

   void functionupper(char []);

   int main()
   {
      char string[100];

      printf("Enter a string to convert it into upper case\n");
      gets(string);

      functionupper(string); // calling functionupper

      printf("Entered string in upper case is "%s"\n", string);

      return 0;
   }

   void functionupper(char s[]) {
      int c = 0;

      while (s[c] != '\0') {
         if (s[c] >= 'a' && s[c] <= 'z') {
            s[c] = s[c] - 32;
         }
         c++;
      }
   }

Result:

Enter a string to convert it into upper case

www.techstudy.org

Entered string in upper case is "WWW.TECHSTUDY.ORG"

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now