Created
August 30, 2010 05:27
-
-
Save kaldas/557053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* $ ex1_vetor_ufrj.c ~rcaldasmd~ 30.08.2010 | |
* | |
* Escreva um programa que leia uma linha de até 80 caracteres | |
* do teclado e imprima quantos caracteres foram lidos. */ | |
#include <stdio.h> | |
//string size | |
#define stsize 80 | |
int i=0; //contador | |
char string[stsize]; | |
int main() | |
{ | |
printf("\nCaro senhor, entre com uma string de ate 80 chars:\n"); | |
scanf("%s",string); | |
while(string[i] != '\0') | |
{ | |
i++; | |
} | |
printf("\nSua string tem: %i char(s)\nbye...\n",i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment