Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

13
String print issue
Post Body

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);

*/

}

Author
Account Strength
90%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,028
Link Karma
162
Comment Karma
418
Profile updated: 2 days ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago