Questions tagged as 'c'

2
answers

Difficulty in using variables between functions

My problem is this: I have difficulty understanding how I can declare a variable within a function and use it in int main (), the code below is the example of this, I tried in several ways and I did not succeed , if anyone can explain to me how...
asked by 18.03.2018 / 17:53
1
answer

Difficulty with If / Else

Hello! It's OK? I'm having a problem when I run my program, it's a program to calculate four means and divide by four, and it's necessary to do this using If and Else, but when I execute, the program reads the first condition, and if the input o...
asked by 15.09.2018 / 23:48
1
answer

How to ask the user to enter the size of the vector?

I'm only using vectors with a defined number using the define or even direct on the variable. How do I put the amount of vectors the user chooses?. example: #define NUMERO x int main() { int valor[NUMERO]; I want this x...
asked by 12.09.2018 / 15:47
1
answer

Problem with functions calling functions - C

I am doing a program to demonstrate the application of relationships. I need to call the functions: int injetora(int M[N][N]){ int i,j,cont; for(j=0; j<N; j++){ cont = 0; for(i=0; i<N; i++){ cont +=...
asked by 10.09.2018 / 13:25
1
answer

How to read a variable of type unsigned char by the function fscanf?

I am reading an array from a file where each element of this array ranges from 0 to 255. For this reason I have stored the values inside an array of type unsigned char, but I am encountering some problems with respect to which specifier to use....
asked by 18.04.2017 / 15:44
1
answer

Bug in a C code [duplicate]

I know, this code is very simple and it's kind of ugly too, I'm a beginner and I'm trying to facilitate this function, can anyone tell me what the error is? Image of the bug: #include<stdio.h>#include<stdlib.h>#include<str...
asked by 16.04.2017 / 23:12
2
answers

How to detect the largest word in a string in C?

I came across this problem during a personal project, it is even more curious, I wanted to please ask anyone who can give me a light with this, since I have solved the problem in other languages only in C that have not yet. p> How can I do to...
asked by 09.05.2017 / 04:54
1
answer

Print a square where the positions of prime number receive a "#" and the others receive "_" [closed]

#include <stdio.h> int main () { int n, i, j; printf("Digite o tamanho do quadrado\n"); scanf("%d", &n); for(i=1; i<=n; i++) { for(j=1; j<=n; j++) { if(i%j == 0) { print...
asked by 02.05.2017 / 02:48
3
answers

language and you give me a small error and I can not correct

I have to do a job and this gives me a mistake that I can not fix, the error says:    assignment to expression with array type The error is in void inicializarcategoria() even need help #include <stdio.h> #include <stdli...
asked by 06.01.2017 / 19:50
1
answer

Even using fflush, the fscanf function is not working

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> struct cadastro{ char nome[30]; float notas[1][4]; int faltas; }alunos[3]; void LimpaTela(){//função para limpar a tela system...
asked by 10.11.2017 / 17:57