Questions tagged [conversion-specifier]

120 questions
1
vote
1 answer

Tracking Multiple Google Analytics Conversions

For our recruiting website we have unique urls for each of our employees connected to their employee numbers. Then they are able to give out their unique URL to their personalized page. Wanting to know if there is an easy/best way to track how many…
1
vote
1 answer

I have written a code to convert from Celisius to Fahrenheit but the output is too huge

The code is: #include #include int main() { double C, F; printf("Enter the temperature in Celisius: "); scanf("%f", &C); F = 32 + (C * (180.0 / 100.0)); printf("%f C = %f F\n", C, F); system("pause"); …
Ambitions
  • 2,369
  • 3
  • 13
  • 24
1
vote
2 answers

Creating new conversion specifier in Python

In python we have conversion specifier like '{0!s}'.format(10) which prints '10' How can I make my own conversion specifiers like '{0!d}'.format(4561321) which print integers in following format 4,561,321 Or converts it into binary…
lordzuko
  • 773
  • 10
  • 22
0
votes
1 answer

the reason why type char can be converted in specifier %d?

I suddenly noticed that i've used conversion specifier %d with type char although %d takes only type int. How is it possible? According to c standard, conversion specifier %d is corresponding to type int argument. And if any argument is not the…
kanoo12
  • 3
  • 3
0
votes
3 answers

Using string specifier for char array?

Code: char x[]={'i',' ' ,'l','i','k','e',' ','c','!'}; printf("%s",x); Result: i like c!�@i like c!�@ I tried to print char array that not terminated with '\0' and using the string specifier %s in printf. I expected for error but which didn't…
0
votes
3 answers

Not able to print the absolute address of global variable address

Baremetal riscv gcc compiled code and linked. I can load my program at any address. firmware calls my program using pointer to my function. I am not able to print the global variables address, its printing offsets instead of absolute address. what…
shaik reyan
  • 129
  • 1
  • 8
0
votes
1 answer

Why does my C program not take input for the name of the cricketer after the loop reaches a value of 2 or greater? How can I correct this?

I have written a c program to create a structure containing the name of cricketer (char array), his age (integer), and number of test matches (integer) that he has played and the average runs (float) that he has scored in each test match. while…
0
votes
1 answer

A problem and lot of Doubts in Printing a String using do while loop

I just tried to print the String which I have received through scanf function and I have set the loop to process further until I press the 0 to terminate. First I have entered the single string, it was normally printed, but another time I have…
Venkat V
  • 1
  • 1
0
votes
3 answers

The scanf to get "name" skips itself when i execute it. What changes do I make inorder for it to no do that?

#include int b; int main() { int a, c; printf("Enter the number of students \n"); scanf("%d", &a); struct studinfo{ char name[50]; int roll; float marks; }; struct studinfo s[10]; for(int i = 0; i <= a; i++) { …
hmmm Mm
  • 11
  • 4
0
votes
1 answer

scanf adds a new line character to my string automatically

I'm trying to solve a basic problem where I have to print a string a output I complete my code and submitted it for test case it prints the correct output but it includes a newline character at the beginning of the output string, due to this the…
0
votes
2 answers

How do I change contents of a variable using a pointer?

I'm working with pointers for the first time in C. I tried to declare, initialize, and assign a memory address to 3 pointers, then print the addresses and values of each pointer and variable, then assign a value to the pointer so that the value of…
0
votes
3 answers

Output does not print the correct variable addresses

Despite using double as datatype and correct format specifiers the output does not print the correct variable addresses output consists of just zeros #include void main() { double a[5] = { 6.0, 7.0, 8.0, 9.0, 10.0 }; double *p; …
0
votes
1 answer

Scanf string being skipped

I'm writing a code and I need to be able to input 2 int values and a line of numbers with spaces inbetween so I wrote: #define _CRT_SECURE_NO_WARNINGS #include #include int main() { int L, X; char lin[25] = {}; …
0
votes
2 answers

Why is my code funtion not working as i want it to?

Here the printAdd function is not working and I am not sure why. There is no error shown in the terminal it just doesn't print the info. #include struct address { int houseNo; int block; char city[100]; char state; }; void…
0
votes
1 answer

Bitwise operator with taking input from user

#include int main() { unsigned char a,b; printf("Enter first number : "); scanf("%d",&a); printf("Enter 2nd number : "); scanf("%d",&b); printf("a&b = %d\n", a&b); printf("a|b = %d\n", a|b); …