Questions tagged as 'c'

1
answer

Problem in assembling an array in C

I'm having a problem with an array that I set to get typed letters and these are transformed into ascii table numbers, but it does not print Where am I going wrong? Can anyone help me? #include <stdio.h> #include <stdlib.h> int mai...
asked by 27.10.2017 / 22:32
2
answers

Targeting failure (recorded core image)

I'm doing a program for a simple purpose: Take a phrase and turn it into a version of it with the characters of each word isolated to the contrary, like: "I'm in trouble" would turn "uotsE moc samelborp". When compiling with gcc questao1.c -o q1...
asked by 25.09.2017 / 04:24
1
answer

How do main function entries in C work?

I've always used the main function as follows, creating other functions: int main() { . . . return 0; } How do entries work in the main function? int main(int argc, char **argv){ We have a variable and a char, right? So...
asked by 20.03.2018 / 21:47
2
answers

String reading

char nome[100], endereco[100], sexo[100]; printf("Digite seu nome: "); scanf("%[^\n]s", nome); printf("Digite seu endereço: "); scanf("%[^\n]s", endereco); printf("Qual seu sexo: "); scanf("%[^\n]s", sexo); I have an erro...
asked by 15.08.2017 / 02:06
2
answers

Segmentation fault: Lists linked in C

I'm here to play a little bit with C and I found that in the second insert I make through the console that lista loses the first pointer created in the first insertion creating a    Segmentation fault; core dumped; Does anyone know...
asked by 04.12.2014 / 19:18
1
answer

Doubt regarding the passage of parameters

In the following code, in line 5, the foo1t function calls the foo1 function by passing two parameters to it, however, the foo1 function has only one parameter. Is this possible or is the code wrong? If it is possible, I wou...
asked by 23.06.2017 / 00:59
2
answers

How to use getche () with do-while in C?

I have the following variable: #include <stdio.h> #include <stdlib.h> #include <conio.h> char op; And I'm asking the user to enter a character: printf("\nDeseja realizar novo teste (s/n) ?"); op = getche(); If the us...
asked by 10.05.2017 / 23:01
2
answers

Why is this code not generating the average correctly?

#include <stdio.h> #include <stdlib.h> float media(int n, float* v){ int i; float s; s = 0; for(i=0;i<n;i++){ s += v[i]; return s/n;} } float variancia(int n, float* v, float m){ int i; float s; for(i=0; i<n; i++){ s +=...
asked by 13.05.2017 / 01:16
1
answer

Print on the dynamic list screen

Personally I can not perform the print function on the screen, could help me in this function below. void imprime_lista(Lista* li){ while (li != NULL) { printf("%d ", li -> struct amatricula); li = li -> prox; } printf("\n");...
asked by 03.10.2017 / 16:40
1
answer

How to compare a string from an array in C?

I have the following variables: char nome[10][8]; int i; --> Sendo esta para o loop I ask the user to enter 5 names and then I read the variable: printf("Entre 5 nomes : \n"); for(i=0; i< 5 ; i++) { scanf("%s",nome[i]); } But aft...
asked by 29.03.2017 / 07:55