This worked for me (eventually...):
#include <stdio.h>
int main(void)
{
char strtest [18] = "keith chad boards";
char strtest1[18];
Type: Posts; User: MisterBadger
This worked for me (eventually...):
#include <stdio.h>
int main(void)
{
char strtest [18] = "keith chad boards";
char strtest1[18];
Hello cheryl_li
#include<stdio.h>
int main(void)
{
char *line="Other Names=Andrew", header[20], content[20];
sscanf(line,"%11c=%s\n", header, content);
Hello, volk
Before the line:
printf("\nEnter three more numbers\n");
you have omitted to re-initialise variables i and sum to zero...
Cheers from MrB :)
Hi GaPe
I used your Multiply function with printf to display a*b.
Do you really need the Multiply function? This line would give the same result:
printf("\nProduct of %d and %d is...
Hello Basia. Was your attempt at the code something like my effort?
With a variety of expressions in the for loops, I came up with this:
#include<stdio.h>
#define MAX 10 /*The maximum...
Hello All...
The following is a variation on a program which maintains consistent string lengths before writing the array of structures to a text (or binary) file.
Following each user input,...
MisterBadger says:
Using pi to 7dp, working in millimetres:
radius of sphere, r = 55mm
Volume of sphere = 4/3*pi*r*r*r;
Overall Volume = 4/3 * 3.1415926 * 55 * 55 * 55;
Mr Shiro said:
By using the exit() function defined in stdlib.h open streams are closed before program termination. exit(1); in this case is the same as exit(EXIT_FAILURE); Hence my use of this...
Is ThIs Ok...
#include<stdio.h>
#include<stdlib.h> /* for exit() function */
#include<ctype.h>
int main()
{
variable 'c' should be a char and the format specifier will need to be a %c:
#include <stdio.h>
int main()
{
char c;
The code for the <Escape> key is 0x1B (no quotes) if that's what you're after...
printf("* * * * * MAIN MENU * * * * *\n\n");
printf("PLEASE SELECT:\n\n");
printf("SOMETHING #1...
I noticed a space before %lf as commented below. Removing this allowed the program to run.
I added the line: i1/=100.0; which gave a correct outcome to the compounded values. I'm not an...
If the data structure of the file data is known, successive strings can be read from the text file using fscanf(). Each %d in the function call will account for a minus sign and store a negative as...
Yes, I got the code tags wrong... Sorry!
MrB
Q1.
[code]
float myNum=25.52, *n_ptr;
n_ptr=&myNum;
printf("%f",*n_ptr); /*Value at address pointed at by n_ptr will be displayed on screen as 25.52*/
[\code]
Q2. Adding 1 to...
This code seems to work for any number of spaces either side of the 'x'... as long as the "change" array is long enough, of course...
#include<stdio.h>
#include<string.h>
int main()
{
...