Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 425 of 3366
680 Views
In this article, we will write Golang programs to implement returning pointer from a function. A pointer stores the address of another variable and the address is depicted using & operator. Algorithm Step 1 − Create a package main and declare fmt(format package) package in the program where main produces executable codes and fmt helps in formatting input and Output. Step 2 − Create a function create_pointer that returns a pointer to the int Step 3 − Set the value of x in the function and return the variable back to the function Step 4 − Create a main ... Read More
2K+ Views
In golang we can use various internal time function to parse time. Time is parsed using parse and ParseInLocation method. Syntax time.Parse() This function belongs to time package. It is used to parse the string into time.Time value and it takes two inputs: the layout and the time string which is to be parsed. time.ParselnLocation() This function is a part of the time package. It is used to parse the string into time.Time value along with a specified location. It takes 3 arguments: the location, layout string and the time string. time.Format() This function is present in ... Read More
381 Views
The Golang Select statement is similar to the switch statement, the switch statement selects the Output based on the cases but here the Output is selected based on which communication occurs fast in the channels. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments. time.Sleep() This function belongs to the time package. Here, the word sleep depicts the meaning of the function which says that it will block the execution of goroutine for ... Read More
489 Views
In golang, Promoted methods are the methods created under those structs which are embedded inside another struct, now the struct in which it is embedded can access its methods and fields. In this article we are going to explain how to show promoted methods using various structs like Rectangle and Square, Vehicle and car. Algorithm Step 1 − Create a package main and declare fmt(format package) package in the program where main produces executable codes and fmt helps in formatting input and Output. Step 2 − Create a Rectangle struct with two fields width and height of type float ... Read More
457 Views
In golang, promoted fields are the structs that are embedded inside another structs and their fields can also be accessed the structs in which they are embedded. In this article we are going to understand three different approaches to depict use of promoted filed with and without the help of pointers. Using Pointers In this illustration, we will make use of pointers to show the promoted fields. The field names will be set with the help of pointers and information will be printed using dot notation. Algorithm Step 1 − Create a package main and declare fmt(format package) package ... Read More
376 Views
In golang, a rand package is used to generate random numbers/characters. Firstly, it seeds with the current time to get the different random Output each time then perform any operation. Syntax rand.Seed(value) Rand.Seed() function is used to generate random numbers. It takes a user input as argument which is the upper limit for generating random numbers. func Now() Time The Now() function is defined in time package. This function generates the current local time. To use this function, we have to first impot the time package in our program. func (t Time) UnixNano() int64 The UnixNano() function ... Read More
286 Views
In this article, we will write Go language programs to show scope of global and local variables using pointer approach. Scope is referred to as the accessibility of the piece of code in the program in particular function. Scope can be defined in two ways: globally and locally. Global means a variable declared in the main cannot be overwritten by any modification and remains same everywhere whereas local access means when variable is modified inside the function, it can only be used inside the function and its scope remains in that function only. Using Same Global and Local Variables In ... Read More
1K+ Views
In this Golang article, we will write programs to print struct variables. Here, there is no concept of classes, instead of that structs are used to represent a collection of related fields or properties. Using Name of the Field and Shorthand Declaration in the Main Function In this method, we will create a child struct and further create two fields name and age in it. The field values are set by creating the instance of the struct. In the second example, the field values of the Child struct are set in the instance using shorthand declaration and the field ... Read More
1K+ Views
Low-level programming languages like C or C++ frequently use pointers to directly handle memory. They enable effective memory management and low-level data manipulation. The low-level complexities of memory administration are abstracted away in Python, a high-level language. Because of this, Python lacks express pointers in an equal manner that C or C++. As an alternative, Python makes use of an idea comparable to this one known as references, which enables indirect access to objects in memory by variables. Python gives builders a sturdy toolkit without requiring them to have a thorough appreciation of low-level memory administration through the use of ... Read More
340 Views
The most popular and widely used programming language across the community is none other than Python. Efficiency, flexibility, and simplicity, all come with Python. It is widely used in more than a few industries, from net enhancement to scientific computing, pc learning, and records analysis. Python has a great library of modules and tools, making it a perfect preference for developing complicated projects. Here, we will go through various major projects developed in Python. YouTube YouTube is one of the most well-known video-sharing platforms in the world, and its backend infrastructure is constructed on Python. The internet framework of YouTube ... Read More