All Questions
15 questions
0
votes
2
answers
205
views
Why does the program stop if I'm using strcpy() on two strings with the exact same size in C?
I use CodeBlocks for Windows as my IDE. In this program, I am trying to copy two different strings (string[8][0] with string[9][0]), and I can't, even though they have the exact same length. I don't ...
1
vote
2
answers
54
views
What is the difference between a 2D string of the type string[10][20] compared to a 2D string of the type *string [10][20] in C?
I am a beginner in C and I use CodeBlocks for Windows.
I learnt that a string is a sequence of characters (chars) but I needed a sequence of strings.
In a video I saw that if I use a pointer in my ...
-3
votes
1
answer
39
views
Why doesn't my first gets() work? I have some of them and codeblocks always forgets the first one?
I'm using gets() cause it's a jomework and we are told to.
It acts like I'd have no gets(&a)...
` char a,b,c;
switch(x);
case '1':printf("Please enter the author\n");
...
0
votes
1
answer
67
views
Getting strings in array out of a loop
I made a loop which takes lines one by one from a test.txt file.
Inside test there is a simple non-sense text:
int main(int argc, char *argv[])
{
return abc, def;
}
The purpose of my program is ...
1
vote
2
answers
44
views
Matrix doesn't keep more than one value [closed]
That is the code:
int qtd_alunos, qtd_temas;
char* tnome[1][10];
char* anome[1][10];
printf("\nPra distribuir os temas me diga quantos alunos vao participar e aperte enter, depois a quantidade de ...
0
votes
2
answers
165
views
Why does puts() function gives me a heart symbol?
I was trying to figure out that how a string with a known size can be filled with single characters. Then I wrote this simple code for a bigger problem that I have
(dynamic filling of a string with ...
-1
votes
3
answers
333
views
Code blocks output console has stopped working
Whenever i declare a varible as char and scan it as string "%s" my output console crashes. Here is the code
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <...
1
vote
1
answer
144
views
When I was trying to run this program in the codeblocks compiler, the strstr() function was returning 0 everytime. Why?
I was making a program to search a track from a list of tracks by getting an input string from user.
#include<stdio.h>
#include<string.h>
char tracks[][80] = {
"...
0
votes
3
answers
289
views
A little query, String in C
Recently I was programming in my Code Blocks and I did a little program only for hobby in C.
char littleString[1];
fflush( stdin );
scanf( "%s", littleString );
printf( "\n%s", littleString);
If I ...
-4
votes
3
answers
34
views
Why the code below does not outputs correctly for all test cases?
/*
*
*Program for finding total number of holes in a string.
*For example total number of holes in "ANUBHAV" is 4 and in "GOURAV" is 3
*
*/
#include <stdio.h>
#include<string.h>
// start ...
0
votes
2
answers
622
views
Strtol() function basic c
When I am using the strtol() function, when I am trying convert:
2015-08-12
I would like it to fail conversion rather than converting only 2015?
int main(int argc, char *argv[])
{
printf("...
2
votes
6
answers
150
views
Why is this code ACTUALLY working?
I've already read a somewhat similar question (why this code works in C) but it doesn't actually gets to explain why is this piece of code actually working:
#include <stdio.h>
#include <...
0
votes
2
answers
268
views
Finding a whole word in text file by using 4-7 letters
I am newbie in C and I will be glad for any help with this program:
Task:
User will enter 4-7 letters (for example 'ADFG').
I have detached text file which contains about several thousand of words
...
-2
votes
2
answers
13k
views
How to find whether the string is a Lapindrome? [closed]
The following code is giving correct output as given on the codechef problem page: http://www.codechef.com/problems/LAPIN
but getting wrong answer on submission
please tell me the possible problem ...
1
vote
2
answers
4k
views
Why strcmp is failing?
I am really sorry to ask this question in this portal. Because it may be a silly problem. But, I am struggling to find out why strcmp is not working?
I did write my own strcmp also and I found out s1 ...