Question

C Programming:- What is the type of the variable x? uint8_t *x[256]; (Do not use spaces...

C Programming:-

What is the type of the variable x?

uint8_t *x[256];

(Do not use spaces in your answer)

What type does the variable x decay to when used in an expression?

uint8_t *x[256]

(Do not use spaces in your answer)

Consider the following function whose purpose is to return an array of 3 strings that are initialized to the strings in the character arrays s1, s2, and s3:

#include <string.h>
#include <stdlib.h>

char** stringstoarray(char* s1, char* s2, char* s3) {

    // dynamically allocate space for the pointer array itself.
    char** strings = ________________________           
  

    strings[ 0 ] = strdup(s1);  // initialize first string
    strings[ 1 ] = strdup(s2);  // initialize first string
    strings[ 2 ] = strdup(s3);  // initialize third string

    return strings;

}

In order for the function for the function to carry out its purpose, fill in the blank with the necessary code.

Do not use spaces in your answer and don't forget a semi-colon at the end of your answer.

Homework Answers

Answer #1

(i)  uint8_t is of unsigned int of length 8bits data type.

(ii) uint8_t has a result of 2^8=256. It is because 255 is the maximum value of an unsigned int or an uint8_t as the range varies from 0-255. So if we put a value of 256, our result would be 0.

(iii) char** strings = new strings *[3];

In this the strings is pointing to 3 string arrays which will further point to the data.

Hope this helps you. For further queries please add your comment below. Please give an upvote. Thank you.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
IN C Consider the following function whose purpose is to return an array of 3 strings...
IN C Consider the following function whose purpose is to return an array of 3 strings that are initialized to the strings in the character arrays s1, s2, and s3: #include #include char** stringstoarray(char* s1, char* s2, char* s3) { // dynamically allocate space for the pointer array itself. char** strings = fill in the blank strings[ 0 ] = strdup(s1); // initialize first string strings[ 1 ] = strdup(s2); // initialize first string strings[ 2 ] = strdup(s3); //...
What is the type of the variable x? uint8_t *x[256]; (Do not use spaces in your...
What is the type of the variable x? uint8_t *x[256]; (Do not use spaces in your answer)
IN C PROGRAMMING A Tv_show structure keeps track of a tv show’s name and the channels...
IN C PROGRAMMING A Tv_show structure keeps track of a tv show’s name and the channels (integer values) that broadcast the show. For this problem you can ONLY use the following string library functions: strcpy, strlen, strcmp. You MAY not use memcpy, memset, memmove. You can assume memory allocations are successful (you do not need to check values returned by malloc nor calloc). typedef struct tv_show { char *name; int num_channels, *channels; } Tv_show; a. Implement the init_tv_show function that...
Part 1 Write a program that reads a line of input and display the characters between...
Part 1 Write a program that reads a line of input and display the characters between the first two '*' characters. If no two '*' occur, the program should display a message about not finding two * characters. For example, if the user enters: 1abc*D2Efg_#!*345Higkl*mn+op*qr the program should display the following: D2Efg_#! 1) Name your program stars.c. 2) Assume input is no more than 1000 characters. 3) String library functions are NOT allowed in this program. 4) To read a...
use c language only to solve this porblem -------------------------- Have the function StringChallenge(str) take the str...
use c language only to solve this porblem -------------------------- Have the function StringChallenge(str) take the str string parameter being passed and return the number of words the string contains (e.g. "Never eat shredded wheat or cake" would return 6). Words will be separated by single spaces. Examples Input: "Hello World" Output: 2 Input: "one 22 three" Output: 3 you have the following code what edits can you do #include <stdio.h> #include <string.h> void StringChallenge(char str[]) {      // code goes...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total 52 case sensitive) and five special characters (‘.’, ‘,’, ‘:’, ‘;’ and ‘!’) in all the .txt files under a given directory. The program should include a header count.h, alphabetcount.c to count the frequency of alphabet letters; and specialcharcount.c to count the frequency of special characters. Please only add code to where it says //ADDCODEHERE and keep function names the same. I have also...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
Write in C++. Define a class called Text whose objects store lists of words. The class...
Write in C++. Define a class called Text whose objects store lists of words. The class Text will be just like the class StringVar except that the class Text will use a dy- namic array with base type StringVar rather than base type char and will mark the end of the array with a StringVar object consisting of a single blank, rather than using '\0' as the end marker. Intuitively, an object of the class Text represents some text consisting...
(c programming) Given the function declaration and documentation below, write the function definition. Do not use...
(c programming) Given the function declaration and documentation below, write the function definition. Do not use the standard library function fgetc. /// @brief Reads a character from specified file input stream. /// @param instream A FILE* variable for an input stream to read a character from. /// @return A character of type char from instream. /// @note This function assumes #include <stdio.h> and a working, valid FILE* variable to an input stream. char grabchar(FILE* instream);
C PROGRAMMING Doubly Linked List For this program you’ll implement a doubly linked list of strings....
C PROGRAMMING Doubly Linked List For this program you’ll implement a doubly linked list of strings. You must base your code on the doubly linked list implementation given in my Week 8 slides. Change the code so that instead of an ‘int’ each node stores a string (choose a suitable size). Each node should also have a next node pointer, and previous node pointer. Then write functions to implement the following linked list operations: • A printList function that prints...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT