Write the following (Saved as linex.c).
It must compile successfully using:
gcc --std=c99 linex.c -o linex
(I have tried using 'gets' method which failed to compile said
'gets' is deprecated, so 'gets' may not be suitable for me, please
provide me with alternative codes which can be compiled with
c99)
It will read a single line of text from standard input.
It will print "R=" followed by that line backwards and then exit
with status 0.
eg:
./linex
123456
would output
R=654321
Notes:
i) your program must not leak memory or perform any
invalid memory accesses.
ii) your program should not use more memory than it
needs.
iii) do not call fgets or getline
Code :-
#include <stdio.h>
#include <string.h>
int main(void){
// Your code here!
char a[10];
int leng=0,g=0;
scanf("%[^\n]",a);
leng = strlen(a);
//print character from end//
printf("R=");
for(g = leng - 1; g >= 0; g--) {
printf("%c", a[g]);
}
}
output:-
Write the following (Saved as linex.c). It must compile successfully using: gcc --std=c99 linex.c -o linex...
A. File I/O using C library functions File I/O in C is achieved using a file pointer to access or modify files. Processing files in C is a four-step process: o Declare a file pointer. o Open the desired file using the pointer. o Read from or write to the file and finally, o Close the file. FILE is a structure defined in <stdio.h>. Files can be opened using the fopen() function. This function takes two arguments, the filename and...
// CSE240 Spring 2019 HW 7 & 8 // Write your name here // Write the compiler used: Visual studio or gcc // READ BEFORE YOU START: // You are given a partially completed program that creates a linked list of patient information. // The global linked list 'list' is a list of patients with each node being struct 'patientList'. // 'patientList' consists of struct 'patient' which has: patient name, room number, and a linked list of 'doctors'. // The...