Questions tagged as 'c'

2
answers

Problem with recursive function, 2 parameters

I'm trying to write this code using recursion: #include <stdio.h> #include <stdlib.h> #include <locale.h> int potencia(int i, int j) { return (j > 0) ? 1 : (potencia(i , j)i * j - 1) * i; } int main(void) {...
asked by 06.03.2018 / 00:04
1
answer

Error at start time string [closed]

#include<stdio.h> int main(){ int numero,unidade,dezena,centena; char *unidades[]={"I","II","III","IV","V","VI","VII","VIII","IX"}; char *dezenas[]={"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; char *centenas[]={"C","CC...
asked by 25.04.2018 / 01:10
1
answer

Exit a program c via CMD

In the following code, when I press 9 the program should exit: case 9: exit(0); After pressing 9 the screen below in the cmd is displayed, but after pressing 9 the message: Press to close this window ... and it is necessary to click a ke...
asked by 16.11.2017 / 23:30
2
answers

How to get the rest of a float number in C?

This question is the one of the URI I thought of this idea more when I will take the rest of float numbers I can not ... #include <stdio.h> int main(int dinheiro) { int res, res2; Here I have an array of integers that I think sho...
asked by 26.11.2017 / 03:57
1
answer

How can I open a file in a void function?

I am trying to open a text file in a int abreArquivoEntrada function, and for this I am sending as a parameter the pointer of type FILE and a vector of char containing the file name, within the function I use to function of...
asked by 03.03.2018 / 21:47
1
answer

List simply chained and not sorted

When running the code below, we have the following problem, when calling the imprime_lista function, when an element has already been allocated in the list, is giving segmentation fault . How do I resolve this? #include <stdio...
asked by 25.10.2017 / 05:12
1
answer

What is the function of this code snippet? Data structure (List)

I need to understand what each command is capable of doing, because it is without comments. struct Node{ int num; struct Node *prox; }; typedef struct Node node; int tam; int vazia(node *LISTA) { if(LISTA->prox == NULL)...
asked by 18.10.2017 / 16:54
2
answers

How to count specific characters

I'm doing a program that counts how many vowels there are in the word, I was able to do it, now I was trying to do just count a vowel in the word, for example Rafael, the appears 2 times, I want you to count only once, could you help me ? #inc...
asked by 02.02.2018 / 13:36
1
answer

Function with vectors in C [closed]

I would like to know how a function in C would receive a vector with N elements and return the number of elements that are above the arithmetic mean of the vector itself.     
asked by 27.09.2017 / 14:12
2
answers

(Segment fault fault) Make a program that receives two distinct sentences and prints inverted

I do not know where the error is. Every time I compile accuse segmentation fault (core dumped) error, can anyone help me? The code is here: #include <stdio.h> int strlen(char *s); char *strrev(char *s); int main() { char frase1[30+1];...
asked by 21.09.2017 / 00:11