We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,849 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

printing abbreviation of given text

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
void main()
{
    char str[50];
    int i=0;
    printf("enter the string: ");
    fgets(str,sizeof(str),stdin);
    printf("the abbrevation of string is");
    printf("%c",toupper(str[i]));
    for(i=0;str[i]!='\0';i++)
    {
        if(str[i]== '')
        {
        i++;
    printf("%c",toupper(str[i]));
        }
    }

}

error at line 14
2
Contributors
2
Replies
3 Hours
Discussion Span
9 Months Ago
Last Updated
3
Views
Question
Answered
rithish
Posting Whiz in Training
268 posts since Apr 2011
Reputation Points: 23
Solved Threads: 9
Skill Endorsements: 0

It would help to read the error message, which mine read somewhere along the lines of empty character constant. Unlike strings(double quotes), there is no implied value(nul value, '\0') in a character literal(single quote) so it would produce an error. Fill the single quote with a space since that's what I think you intend.

asrockw7
Junior Poster in Training
86 posts since Apr 2011
Reputation Points: 28
Solved Threads: 6
Skill Endorsements: 0

ok thanks dude iam known to it

rithish
Posting Whiz in Training
268 posts since Apr 2011
Reputation Points: 23
Solved Threads: 9
Skill Endorsements: 0
Question Answered as of 9 Months Ago by asrockw7

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0603 seconds using 2.68MB