Questions tagged as 'c'

3
answers

Help in string programming logic?

I'm new to this string area and I'm having a hard time. My algorithm must find and return the index of the first occurrence of the key (that the user types) in the string, otherwise it should return -1. What is wrong with my function? #include...
asked by 13.06.2018 / 20:25
2
answers

Detect when a new file was created

Details: I have an application where: I have an AJAX request with JQuery triggered every time I new users are inserted by passing the necessary data to a PHP file that receives them via POST and creates a JSON file with these data. Th...
asked by 17.11.2015 / 15:58
1
answer

Why do I receive this Segmentation Fault?

Why do I declare: char *s = "string"; fscanf(stdin, "%s", s); Do I get a Segmentation Fault?     
asked by 17.12.2015 / 20:18
2
answers

How to do operations between functions in C?

The funA() function stores a value entered by the user. The funB() function will allow the user to choose an option. My difficulty is in the third function: I need to create a function that multiplies the value stored in the first...
asked by 28.09.2015 / 20:00
2
answers

Why "segmentation fault" when merging two arrays?

I'm building a simple c / c ++ program that merges two arrays but I'm encountering an inconvenient error. I believe that when calling the function IntercalarArranjos , the program presents an error of type "segmentation fault". I do n...
asked by 07.01.2016 / 16:37
2
answers

My struct declaration is wrong?

#include <stdio.h> #include <stdlib.h> fun1(int ptr,int data) { data.ano=1990; data.mes=5; data.dia=15; ptr->nome="Bigown"; ptr->cpf="040502016"; } int main () { typedef struct { int ano; int mes;...
asked by 04.05.2016 / 20:15
1
answer

Error compiling C in gcc: No such file or directory

I'm trying to compile a .c file but I'm not getting it. I type the following command: gcc main.c -o HELLO and the following error appears: gcc: error: main.c: No such file or directory gcc:fatal error: no input files compilation terminate...
asked by 17.09.2015 / 21:37
2
answers

Relate structs in C

Hello, I have to do the relation between structs in a work in C. I have a struct player with the fields name and code and an animal struct that has the fields name and code. I can normally insert players and animals each into their struct. str...
asked by 15.03.2017 / 01:08
1
answer

Code stacking and unstacking a stack

I'm testing this code in codeblocks and it's giving a very strange result, saying the stack is empty and I can not see where the error is. void empilha (int *p[], int *topo, int valor){ if (*topo<10) { p[*topo] = valor;...
asked by 09.03.2017 / 16:24
2
answers

Encryption in ASCII in C

I need help with this, I already did the functions that encryption and decryption, it encrypts normal, but at the time of decryption it certainly does not do the process correctly. The error and the following: to encrypt I think it encrypts c...
asked by 25.03.2015 / 15:02