Skip to content

Issues with arraysND.c and arraysND.h #4

@Navneet1206

Description

@Navneet1206

Dear Repository Owner,

I hope this message finds you well. I am currently exploring the "Learn C Programming" repository, specifically Chapter 12, which includes the files arraysND.c and arraysND.h. I wanted to bring a couple of issues I encountered while working with these files to your attention that.

Function Prototypes in Header File: The header file arraysND.h does not include include guards. Adding include guards would prevent multiple inclusions of the header file, which can lead to compilation errors. I recommend wrapping the function prototypes with #ifndef, #define, and #endif preprocessor directives.
Function Declarations: The functions defined in arraysND.c are used in the main function but are declared after it. To avoid implicit declaration warnings, it would be beneficial to declare these functions at the beginning of the file.
Variable Initialization: In arraysND.c, the variable pretty is true, but the code checks for !pretty in the print functions. If the intention is to demonstrate both pretty and regular printing, it might be useful to set pretty to false for testing purposes.
Compiler Warnings: When compiling with -Wall -Werror, ensure that the code is free of warnings. For example, unused variables or functions may trigger warnings that could be addressed.
I appreciate your efforts in creating this educational resource, and I hope these suggestions help improve the code's clarity and functionality. Thank you for your time!

Best regards,

Navneet

github.com/Navneet1206

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions