This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I built a small program that takes in a string, then captures the string length. I want it to print a specific character, n, equal to the length of the string. for whatever reason, it doesn't print and I can't figure out why...
PLEASE DO NOT PRINT UPDATED CODE. snippets are fine with explanations, but I want to learn this material not just have it done for me. Thanks all.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main ()
{
char w[50];
printf("Please enter a word: \n");
scanf("%s", w);
printf("%s\n", w);
int l, k;
k = 0;
l = 0;
l = strlen(w);
printf("%d\n", l);
for (k=0, k < l; k ) {
printf("n");
}
/*
printf("\n");
printf("%s\n", w);
*/
}
Subreddit
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cprogrammin...