Questions tagged as 'c'

1
answer

What is the difference between a .c and .cpp file?

C and C ++ are two different languages, however C ++ is a superset of the C language. So what's the difference between a file with the extension in .c and .cpp ?     
asked by 01.12.2016 / 22:24
1
answer

How to include in Python a function made in C?

I want to use a function made in C . Example: I have a function int swap(){ printf("lista"); } And I want to call it Python ...     
asked by 23.10.2015 / 18:32
1
answer

How to make a function inside a function return a vector?

I have a job for my course, and it is necessary to make a program similar to the megasena game. It's almost ready, but I'm finding a little problem and need help. Data of the work: maximum of 10 players can bet, each one can bet from 6 up to 15...
asked by 29.05.2014 / 23:08
1
answer

Retry user and password attempts

I wanted a program that checks the user and password, if it was correct to display a message, if it repeated the check and if the attempts were equal to 3, it showed the limit message of attempts reached. #include <stdio.h> #include <...
asked by 02.05.2016 / 13:32
5
answers

Keyboard buffer cleaning after scanf

I'm having problems with the scanf(); function. When reading two or more values, subsequent values are not read. I've already tried: __fpurge(stdin); After doing the readings, but in this case, I need to give an enter after each...
asked by 15.03.2014 / 18:25
1
answer

Socket between 2 clients and 1 server in C

How to receive two connections? The system consists of 2 clients and 1 server, the server must receive the connections and initiate a sequential conversation with the clients. I was able to implement the communication between 1 client and t...
asked by 03.12.2014 / 16:54
3
answers

Why do pointers have fixed size regardless of the type pointed?

The space occupied by normal variables ( int , float , double , char ) obeys the type rule: int occupies 4 bytes, float occupies 4 bytes, double occupies 8 bytes etc. Why do pointers of different t...
asked by 29.06.2017 / 20:45
1
answer

How to execute inline assembly in a code with variables in C?

From an example of a book, I was able to run the following assembly code (AT & T) with the gas, which returns a message with the name of the processor: .section .data output: .asciz "The processor Vendor ID is '%s'\n" .section .bss ....
asked by 08.02.2015 / 00:46
2
answers

"Operator" brackets [] in creating the arrangement in C

Whenever I look for what the brackets operator [] does, even in the tables that show all operators in C, it appears that it serves to access an element of an array. However, this is not always the case, for example in the case where the a...
asked by 12.09.2018 / 16:20
3
answers

Split result gives zero in the decimal places

In the 1 by 3 division, my program is printing the following:    the value of number e 'of 0.00 What is the error in the code? #include <stdio.h> int main(){ float numero; numero = 1/3; printf("o valor do numero e'...
asked by 10.12.2014 / 23:31