Questions tagged as 'c'

1
answer

Not booting error

I'm having a non-boot error, and I can not figure out why: #include <stdio.h> int main(){ const int LENGTH = 10; const int WIDTH = 5; const char NEWLINE = "\n"; int area; area = LENGHT * WIDTH; printf("Value of area : %d", ar...
asked by 12.12.2017 / 21:51
1
answer

How to pass a .txt file to a function

I would like to create a function that receives a .txt file and does something with it, but I do not know how to set the send and receive parameters, or if I should do parameter passing by reference. Send file to function: funcaoRec...
asked by 09.12.2017 / 00:18
1
answer

Error in inversion of a string

I'm trying to invert a string through a function but it is giving error, but I do not know where it is wrong. Just below is my code. #include<stdio.h> #include<stdlib.h> #include <string.h> char troca(char nome[100], c...
asked by 26.12.2017 / 17:30
3
answers

Repetition of elements

I am having difficulty outputting the number of elements repeated in the vector. Here is the code: #include <stdio.h> #include<stdlib.h> int main() { int N, i, temp, repetidos = 1; int *v1; printf ("Entre com N: ");...
asked by 07.11.2016 / 22:32
3
answers

Can I store values without using static vectors?

I need to create a sparse array of type dynamic cross-list and my cells are of type: typedef struct CELULA{ int linha; int coluna; double valor; }CELULA; However, every time I create a new cell in a function, I do not know how...
asked by 05.11.2017 / 12:40
1
answer

Doubt in a question of pointers in C

The question is this: Construct a function that takes two integer values a and b , return (passing by reference) the quotient, div, and the remainder division, mod, from a to b . The function should return -1...
asked by 03.11.2017 / 22:35
1
answer

Which code has a higher cost? (Bubblesort in C)

void bubblesort(int *A, int n) { int i, aux; for(i=0; i<n-1; i++){ if(A[i]>A[i+1]){ aux = A[i]; A[i] = A[i+1]; A[i+1] = aux; } } if(n-1>1) bubblesort(A, n-1); }...
asked by 15.01.2018 / 18:46
2
answers

Can someone explain to me what this code does line by line?

void primeiro(int a) { a *= 2; printf("%d", a); } void segundo(int *u) { int x = 1; x = x + *u; primeiro(x); *u = x++; } int main() { int x = 5; segundo(&x); printf(":%d\n", x); }     
asked by 14.01.2018 / 17:41
1
answer

Article name does not let enter

I want to enter the item name only that he does not leave, I've done the same way the scanf same as the vendor name but do not let introduce equal #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno....
asked by 07.11.2017 / 16:09
1
answer

Error in the average calculation of a student record

printf("Nota 1: "); scanf("%.1f", &alu[n].not1); printf("Nota 2: "); scanf("%.1f", &alu[n].not2); alu[n].media = (alu[n].not1+alu[n].not2)/2; // o erro acontece NESSA LINHA    invalid operands to binary + (have 'float *' and 'float *'...
asked by 02.11.2017 / 21:40