language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C |
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <pthread.h>
#include <sys/queue.h>
#include "event.h"
#include "log.h"
#include "worker.h"
struct worker
{
pthread_t tid;
STAILQ_HEAD(event_list, event) event_list;
volatile size_t event_n;
pthread_mutex_t event_lock;
pthread_c... |
C | /*!file
*
* @brief The implementation of routines for erasing and writing to the Flash.
*
* This contains the implementation for operating the LEDs.
*
* @author John Thai & Jason Garviel
* @date 2017-04-10
*/
/*!
* @addtogroup LED_module LED module documentation
* @{
*/
/* MODULE LED */
#include "LEDs.h"
#... |
C | #include <stdio.h>
void main() {
int n;
printf("Unesite velicinu kvadratne matrice: ");
scanf("%i", &n);
int matr[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
printf("matr[%i][%i] = ", i, j);
scanf("%i", &matr[i][j]);
}
}
for (int i = 0; i < n; i++) {
for (in... |
C | #include <stdio.h>
int strlen(char* s);
void mostrar(int i);
int main(int argc, char const *argv[]){
int i;
char s[256];
scanf("%[^\n]%*c", s);
i = strlen(s);
mostrar(i);
return 0;
}
int strlen(char* s){
int i;
for(i = 0; s[i]; ++i);
return i;
}
void mostrar(int i){
printf("\nstring possui %d caracteres!... |
C | #include <stdbool.h>
#include <stdio.h>
#include <string.h>
#define BUFFER_SIZE 128
struct DataInfo
{
char data_file_name[BUFFER_SIZE];
char index_file_name[BUFFER_SIZE];
unsigned keyStart,keyEnd, record_length;
char encoding[4] , order[5];
};
struct IndexData
{
char* key;
unsigned pos;
};
char... |
C | #if !defined(AFX_URLENCODE_INCLUDED_)
#define AFX_URLENCODE_INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
inline BYTE toHex(const BYTE &x)
{
return x > 9 ? x + 55: x + 48;
}
inline BYTE toByte(const BYTE &x)
{
return x > 57? x - 55: x - 48;
}
CString URLDecode(CString sIn... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NUM_THREADS 4
#define NUM_LINES 20
char *lines[NUM_LINES];
int line_diffs[NUM_LINES - 1];
void read_file();
void line_diff(size_t my_id);
int line_sum(size_t line);
void free_lines();
void print_diffs();
int main(void)
{
read_file();
for (s... |
C | /**
****************************************************************************************
*
* @file menu.c
*
* @brief Implementation of application menu
*
* Copyright (C) 2015-2016 Dialog Semiconductor.
* This computer program includes Confidential, Proprietary Information
* of Dialog Semiconductor. All Rig... |
C | #include <stdio.h>
int main(void)
{
int repeat, ri;
double rate, salary, tax;
scanf("%d", &repeat);
for(ri = 1; ri <= repeat; ri++){
scanf("%lf", &salary);
if(salary<=850){
tax=0;
}
else if(salary<=1350){
rate=0.05;
tax= rate * (salary - 850);
}
else if(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define M 16
void mojisort(char *h){
int i, j;
char a;
for(i=0; h[i] != 0; i++){
for(j=i+1; h[j] != 0; j++){
if(h[i]>h[j]){
a = h[i];
h[i] = h[j];
h[j] = a;
}
}
}
}
int main(void){
char t[17];
FILE *fp;
char *fname = "dic... |
C |
/*******************************************************************************
@brief: ģڶjsonзװ,ʹkeyԽṹԱֵԼ
ṹԱ.ģзkeyбֳĽṹ,
ݵõIJηλ.ģṩֻ
,洢ṹСԱ,ֱΪ:long long ;doubleĸ
Լַ;(ָ,boolδ洢).
ģ洢ݳԱʱ,һ˳洢,ģԹϣķʽ
洢Ա,Լӿٶ.
ģṩʽkey,ѭԱ.
*******************************************************************************/
#ifndef __GX_JANSS... |
C | /*
* File : mod_communication.c
* Project : e_puck_project
* Description : Module in charge of bluetooth communcations with distant device
*
* Written by Maxime Marchionno and Nicolas Peslerbe, April 2018
* MICRO-315 | École Polytechnique Fédérale de Lausanne
*/
#include "headers/mod_communication.h"
// Stand... |
C | //
// Climbing Stairs
// https://leetcode.com/problems/climbing-stairs/#/description
//
#include <stdio.h>
#include <stdlib.h>
int climbStairs(int n)
{
int i;
int *a;
int s;
if (1 == n)
return 1;
if (2 == n)
return 2;
a = (int *)malloc(n * sizeof(int));
... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | //Made for Arduino nano by John Arild Lolland
//psudo code:
//Master skal fungere som ledd mellom RS485 og RS232
//RS485 brukes for å kommunisere med slavene.
//RS232 brukes for å kommunisere med VS481B
//Det forventes ikke kommunikasjon fra VS481B hvis ikke kommando er sendt først
//To seriell porter er nødvendig for... |
C | // SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018 Oracle. All Rights Reserved.
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*/
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <unistd.h>
#include "platform_defs.h"
#i... |
C | #include <stdio.h>
#include <stdlib.h>
/*=============================================================================================
Universidade Federal Fluminense
Curso de Ciencia da Computacao
Estrutura de dados - Arvore Binaria de Busca
Professor: Dalessandro
Alunos: Claudio Rodrigues Nunes
Ramo... |
C | /******************************************************************/
/* Copyright (c) 1989, Intel Corporation
Intel hereby grants you permission to copy, modify, and
distribute this software and its documentation. Intel grants
this permission provided that the above copyright notice
appears in a... |
C | /* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <time.h>
#include "../util.h"
const char *
datetime(void)
{
time_t timer;
struct tm* tm_info;
time(&timer);
tm_info = localtime(&timer);
strftime(buf, 25, " %d.%m.%Y %H:%M", tm_info);
return buf;
}
/*
con... |
C | #ifndef DOUBLELIST_H
#define DOUBLELIST_H
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
struct node *next, *back;
void* info;
} DNODE;
void add(DNODE** head, int n, void* x);
void add_to_beginning(DNODE** head, void* x);
void add_to_end(DNODE** head, void* x);
void rem(DNODE** head, int n);
vo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strmap.c :+: :+: :+: ... |
C | #include <stdio.h>
void swap(char *a, char *b, int width){
char tmp;
while(width){
tmp = *a;
*a = *b;
*b = tmp;
a++;
b++;
width--;
}
}
int main(){
int a = 5;
int b = 10;
char str1[10] = "abcde";
char str2[10] = "xxx";
printf("a = %d b = %d\n", a, b);
printf("str1 = %s str2 = %s\n", str1, str2);
... |
C | #include <stdio.h>
int binary_search(int *arr, int low, int high, int search_num){
int mid;
if (low > high)
return -1;
mid = (high + low) / 2;
if (search_num == arr[mid])
return mid + 1;
if (search_num > arr[mid])
return binary_search(arr, mid + 1, high, search_num);
else
return binary_search(arr,... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void)
{
int *ptr = NULL;
int num = 0;
int i = 0;
while(num != -1)
{
printf("请输入一个数字: ");
scanf("%d",&num);
i++;
ptr = realloc(ptr,sizeof(int)*i);
if(ptr == NULL)exit(1);
ptr[i-1] = num;
}
if(num == -1)
{
for(int n = 0; n < i; n++)
... |
C | #include <stdio.h>
int factorial(int n)
{
int i;
int fact = 1;
for (i = 1; i <= n; i++) {
fact *= i;
}
return fact;
}
int enshu_2_1(int begin, int end){
if(begin>end){
return 0;
}
int i=begin;
while(i<end+1){
printf("%d! = %d\n",i,factorial(i));
i=i+1;
}
retu... |
C | #include<stdio.h>
void inverted_triangle()
{
int n;
printf("enter value");
scanf("%d",&n);
//inverted 01
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
printf("01");
}
printf("\n");
}
}
void hollow_square()
{
int n;
printf("enter value");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int j=1;j... |
C | #include<stdio.h>
#include<stdlib.h>
int main (){
int arr[]={100,200,300,400,500};
int *pointer=&arr;
int i;
for(i=0;i<5;i++){
printf("arr[%d]=%d\n",i,arr[i]);
}
//t@تܤ覡//
printf("\nt@تܤ覡\n");
for(i=0;i<5;i++){
printf("arr[%d]=%d\n",i,*(arr+i));
}
//ĤTتܤ覡//
prin... |
C | #define _GNU_SOURCE
#define debug
#include <getopt.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "cachelab.h"
#define FILENAMELEN 40
#define TRACESIZE 30
#define check(s,c) (s[0]==c)
typedef struct{
int is_valid;
int tag;
int access_timestamp;
}line;
static int hits =... |
C | /*abdullah c
assign 3 prob 1
feb 10
*/
#include <stdio.h>
int main(void){
//variables
int howmany,i ;
float value,total=0;
//initial input
printf("Enter integers (first number is how many): ");
scanf("%d",&howmany);
//gets numbers in loop
for(i=1;i<=howmany;i++){
scanf("%f",&value);
total+=value;
}
//output... |
C | #ifndef MQTTCONF_H
#define MQTTCONF_H
#include <Arduino.h>
#include <ArduinoJson.h>
#include <tools.h>
#ifndef ESP32
#if filesystem==littlefs
#include <LittleFS.h>
#else
#include <FS.h>
#define SPIFFS_USE_MAGIC
#endif
#else
#include <FS.h>
#include <SPIFFS.h>
#define SPIFFS_USE_MAGIC
#endif
#... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "hpctimer.h"
#define TN 64 * 1024
#define PAGE_SIZE 4 * 1024
#define T_SIZE PAGE_SIZE/3
struct Foo
{
char arr[T_SIZE];
char arr1[T_SIZE];
char arr2[T_SIZE];
char arr3[T_SIZE];
char arr4[T_SIZE];
char arr5[T_SIZE];
};
int main(void)
{
int i... |
C | #include "command.h"
#include "client.h"
#include "upload.h"
#include "download.h"
#include "select_cycle.h"
#include <unistd.h>
struct toy_select_cycle_s
{
fd_set rd_set;
fd_set wr_set;
fd_set excep_set;
int max_fd;
} toy_select_cycle_global;
void toy_selcycle_fdset_add_fd(int fd, enum FDSET_TYPE set_type)
{... |
C | #include"wordSystem.h"
#include<stdio.h>
#include<string.h>
int
wordSysPat()
{
printf("请选择登录的模式‘1’离线模式,‘2’在线模式:");
char answer[10];
while(1)
{
fscanf(stdin,"%s",answer);
if(!strcmp(answer,"1"))
{
system("clear");
wordSysLogin();
return 1;
}
else if(!strcmp(answer,"2"))
{
system("clear");
... |
C | //Multi-dimensional arrays in C
#include <stdio.h>
void main()
{
int a1[4];
int a2[2][3];
float a3[4][5][2];
char a4[1][2][3][4];
int ar[3][3][3];
int count = 0;
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
for (int k = 0; k < 3; ++k)
{
... |
C | /*
* sun_au.datatype by Fredrik Wikstrom
*
*/
#include "au_class.h"
#include "au_format.h"
#include "au_alaw.h"
static int16 decode_alaw (uint8 a_val);
static int16 decode_mulaw(uint8 u_val);
DEC_SETUPPROTO(SetupALAW) {
data->sample.size = 1;
data->block.size = data->sample.size * data->au.channels;
data->bloc... |
C |
/***
void add_to_list( list* lista, int value);
list* ColumnSearch(column *Column,void* data);
***/
#include <stdlib.h>
#include <stdio.h>
#include "table.h"
#include "list.h"
#ifndef SEARCH
#define SEARCH
///
// DEFAULT -> used for search of not interesting stuff, looks for
// numbers in case of I... |
C | #include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include "sish.h"
int last_cmd = 0;
int main(int argc, char*argv[]){
char buf[BUFSIZ];
last_cmd = 0;
int x_flag = 0, c_flag = 0;... |
C | /*
** EPITECH PROJECT, 2019
** my_strlan.c
** File description:
** my_strlen.c
*/
#include "my.h"
int my_strlen(char const *str)
{
int i = 0;
if (!str)
return 84;
while (str[i] != '\0' && str[i] != '\n') {
i++;
}
return i;
}
int my_strlen_pipe(char const *str)
{
int i = 0;
... |
C | /*
** EPITECH PROJECT, 2017
** my_printf
** File description:
** raphael.dubois@epitech.eu
*/
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include "my.h"
int flags1(int i, char *str, va_list ap);
int flags2(int i, char *str, va_list ap);
int flags3(int i, char *str, va_list ap);
void compile(va_list ap... |
C | /*
** my_subtract.c for bistromathique in /home/semana_r/rendu/Piscine_C_infinadd
**
** Made by romain semanaz
** Login <semana_r@epitech.net>
**
** Started on Wed Oct 28 18:04:32 2015 romain semanaz
** Last update Sun Nov 1 22:50:56 2015 Yann Pichereau
*/
#include <stdlib.h>
#include "my.h"
#include "bistromath... |
C | /* Shift Cipher by Barrientos, Monica */
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
char* encryption();
char* decryption();
int main()
{
int choice;
char* encrypted;
char* decrypted;
do
{
printf("\nWelcome to Monoalphabetic Encryption and Decryption\n");
printf(... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <string.h>
#include <unistd.h>
int main() {
int s;
struct sockaddr_in server, client;
int c, l, i;
uint16_t k, old = 0;
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
printf("... |
C | #ifndef DINO_STEAM_CONTROLLER_H
#define DINO_STEAM_CONTROLLER_H
#include <stdint.h>
#include <usbdrvce.h>
#include <stdbool.h>
enum {
SC_HAPTIC_RIGHT,
SC_HAPTIC_LEFT
};
typedef bool sc_haptic_t;
/**
* Gets the interface number to use for controlling haptic feedback
* @param dev USB device to check
* @retu... |
C | #include "lists.h"
/**
* add_node_end - adds a new node at the end of a list_t list.
* @head: double pointer to a data structure.
* @str: pointer to a string.
*
* Return: the address of the new element, or NULL if it failed.
*/
list_t *add_node_end(list_t **head, const char *str)
{
list_t *newend;
int i;
list... |
C | #include <cs50.h>
#include <stdio.h>
int main(void)
{
// TODO: Prompt for start size
int start;
do {
start = get_int("Start size: ");
}
while(start < 9);
// TODO: Prompt for end size
int ends;
do{
ends =get_int("End size:");
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Person {
char name[30];
int* age;
} Person;
void print_person(Person* p) {
printf("%s: %d\n", p->name, *p->age);
}
int main() {
Person p;
strcpy(p.name, "safdas");
p.age = (int*)malloc(sizeof(int));
*p.age = 23;
Person p2 = p;
print... |
C | #include"my402list.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
/*
typedef struct data
{
char type[2];
unsigned long int timestamp;
unsigned long int amt;
char *desc;
//int num;
}data;
*/
//int My402ListTraverse(My402List*);
//void processfile(FILE *,My402List*);
//void ListDispTransac(... |
C | #include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
int pipefd[2];
char* str = "hello\n";
char buf[200];
int ret;
pipe(pipefd);
ret = fork();
assert(ret >= 0);
if (ret == 0) {
close(pipefd[0]); /*for read*/
... |
C | #include <stdio.h>
#include <string.h>
#include <limits.h>
int dp[101][101];
int chain_mul(int arr[],int i,int j)
{
if(i==j)
return 0;
if(dp[i][j]!=-1)
return dp[i][j];
dp[i][j]=INT_MAX;
int k;
for(k=i;k<j;k++)
{
int curr=chain_mul(arr,i,k)+chain_mul(arr,k+1,j)+(arr[i-1]*arr[k]*arr[j]);... |
C | #include <stdio.h>
// define some constants
#define LOWER 0
#define UPPER 300
#define STEP 20
#define NAME "Alexander"
main()
{
int c;
long fahr;
double nc;
/** Print Fahrenheit-Celsious table
Conversion: C = (F-32)*5/9
*/
printf("Fahrenheit-Celsius table\n");
f... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "numeric.h"
/*newtonRhapson function starts*/
void newtonRhapson(void){
/*Variable declarations
*@degree: Maximum exponent of variable
*@iteration: Iteration number
*@xZero: Starting value
*@xNew: x0 + deltax value
*@epsilon: Tolerance. Equ... |
C | #include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <math.h>
int count_letters();
int count_sentences();
int count_words();
double calc_readability();
int main(void)
{
//string phrase = get_string("Text: ");
string phrase = "";
double letters = count_letters(phrase);
//printf("Number o... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
char* solution(int a, int b) {
int SumODays, i;
SumODays = 0;
int dateArr[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
char* dayArr[7] = {"FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU"};
char* answer;
// 리턴할 값은 메모리... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools_env.c :+: :+: :+: ... |
C | #include "ft_door.h"
#include <unistd.h>
#include <stdlib.h>
void ft_putstr(char *str)
{
int i;
i = 0;
while (str[i])
{
write(1, &str[i], 1);
i++;
}
}
void ft_close_door(t_door *door)
{
ft_putstr("Door closing...");
door->state = CLOSE;
return;
}
t_bool is_door_open(t_door *door)
{
ft_putstr("Is doo... |
C | // list.c
#include "list.h"
#include <stdlib.h>
ListNode * ListNode_create(TreeNode * tn)
{
ListNode * ln = malloc(sizeof(ListNode));
ln -> next = NULL;
ln -> tnptr = tn;
return ln;
}
// head may be NULL
// ln must not be NULL
// ln -> next must be NULL
ListNode * List_insert(ListNode * head, ListNode * ln,
... |
C | #ifndef factorial_function
#define factorial_function
int factorial(int a)
{
int result =1;
// printf("funtion %d\n",a);
if (a>1)
{
result=a*factorial(a-1);
}
return result;
}
#endif
|
C | /*******************************************************************************
* mb_motors.c
*
* Control up to 2 DC motordrivers
*
*******************************************************************************/
#include "mb_motors.h"
// global initialized flag
int mb_motors_initialized = 0;
/**********************... |
C | #include <sys/types.h>
#include <sys/mman.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define PAGE_SIZE 4096
int main()
{
printf("%d\n", PAGE_SIZE);
int fd;
fd = open("test2.txt",O_RDWR | O_APPEND);
printf("%d\n", fd);
char* ptr1 = NUL... |
C | #include <stdio.h>
#include <math.h>
static double getDistance(double x1, double y1, double x2, double y2)
{
return(sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)));
}
int main()
{
double x1 = 0.0;
double y1 = 0.0;
double x2 = 4.0;
double y2 = 3.0;
double distance = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) ... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct CARD {
char *face;
char *suit;
}card;
int main()
{
card acard;
card *cardPtr;
cardPtr = &acard;
acard.face = "Ace";
acard.suit = "Spades";
cardPtr = &acard;
printf("%s %s %s\n%s %s %s\n%s %s %s\n",acard.face,"of",acard.suit,cardPtr->face,"of",cardPtr->suit,(... |
C | //David Krampert
//
//
//
//
///////////////////////////////////////////////////////////////////////////////
// Includes -------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/types.h>
#inc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
// Ringrazio Kledi (Negahertz) per avermi aiutato nel debugging
// Qesto programma contiene una struttura lista in grado di
// contenere più tipi di variabile
// Per ora solo interi caratteri e stringhe
// definisco le strutture lista e n... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main(){
int len;
char label[20], mne[20], opnd[20], name[20], mne1[20], opnd1[20], arg[20];
FILE *inp, *argtab, *deftab, *namtab, *output;
inp = fopen("inp_self.txt", "r");
argtab = fopen("argtab.txt", "w+");
deftab = fop... |
C | // Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "dictionary.h"
#define ALPHABET_LENGTH 27
typedef struct node
{
bool is_word;
struct node* children[ALPHABET_LENGTH];
}
node;
node *root = NULL;
int numbe... |
C | /*
llcv.h: definitions enabling the use of in-memory doubly-
linked lists (Lysts) as inter-thread communication
flows.
Like sdrpipes and sdrcvs, llcvs transmit variable-
length messages without flow control: the writing
rate is completely decoupled from the reading rate.
An llcv comprises a Lyst, a m... |
C | /* $begin shellmain */
#include "csapp.h"
#define MAXARGS 128
typedef struct redirects{
char* in;
char* out;
char* err;
} RedirectionPaths;
RedirectionPaths init_r_paths(){
RedirectionPaths rpath;
rpath.in = NULL;
rpath.out = NULL;
rpath.err = NULL;
return rpath;
}
/* function prototypes */
void eval(char ... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
struct node* link;
int data;
};
void enumerate(struct node *head)
{
printf("your list is ==> \n \n");
struct node* current=head;
while(current!=NULL)
{
printf("%d \n",current->data);
current = current->link;
}
}
int is_element(struct node* head,int... |
C | #include <stdio.h>
#include <stdlib.h>
const int N = 4;
int g_next = 938;
int prng()
{
g_next += 3827;
g_next %= 97;
return g_next;
}
int main()
{
int *buf = (int*)malloc(sizeof(int) * N);
for (int i=0; i<N; i++)
buf[i] = prng();
printf("negative: ");
for (int i=0; i<N; i++)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "geladeira.h"
void criageladeira(geladeira *q,char Cor[10],char Material[15], float Peso, float Preco, float Altura){
strcpy(q->cor,Cor);
strcpy(q->material,Material);
q->peso=Peso;
q->preco=Preco;
q->altura=Altura;
}
void trocacor(geladeira *... |
C | //
// Created by Sakura on 2020/10/30.
//
#include <stdio.h>
#include <stdbool.h>
int FactorialRecursive(int num)
{
int res;
if (num < 0)
{
printf("С0!");
return false;
} else if (num == 0 || num == 1)
{
res = 1;
}
else
{
res = FactorialRecursive(num - 1)... |
C | #include <stdio.h>
int main(void) {
int zippo[4][2] = {
{2, 4},
{6, 8},
{1, 3},
{5, 7}
};
printf("zippo = %p, zippo + 1 = %p\n", zippo, zippo + 1); //zippo = 00D6F760, zippo + 1 = 00D6F768 zippointСԪ
printf("zippo[0] = %p, zippo[0] + 1 = %p\n", zippo[0], zippo[0] + 1); //zippo[0] = 00D6F760, zippo[0] +... |
C | #include <sys/time.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEFAULT_WIDTH (8192)
#define DEFAULT_HEIGHT (4096)
/* from: https://qiita.com/NaOHaq/items/55573f088d0b1d3b0dc6
*
* perf stat -d ./horizontal
* perf stat -d ./vertical
*/
static double
get_current_time( ... |
C | #include "log.h"
#include "uart.h"
#include "flash.h"
#include "xc.h"
// Number of bits to shift the upper nibble of a byte into the lower nibble.
#define UPPER_NIBBLE_SHIFT 4U
// Bitmask for isolating the lower nibble of a byte.
#define LOWER_NIBBLE_MASK 0x0F
// Number of bits to shift the middle byte of a flash wo... |
C | #include<stdio.h>
int main()
{
printf(" Today's class we learnt basics of C programming \n \n");
printf(" It was interactive class\b\b");
printf(" \'Mam teaching method was good \a\a'" );
printf(" I have made some friends " );
printf(" Today we have covered Datatypes,Variables,Format specifiers, Escape sequence ... |
C | #include<stdio.h>
int main(){
int i, num, row;
printf("Enter no : ");
scanf("%d",&num);
printf("row : ");
scanf("%d",&row);
for(i=1; i<=row; i++ ){
printf("%d * %2d = %d",num,i,num*i);
printf("\n");
}
return 0;
} |
C | #include <stdio.h>
#include <math.h>
#include <string.h>
void dtoh(int n)
{
char arr[10];
int i;
int temp = n;
for (i = 0; temp > 0; i++)
{
int r = temp % 16;
if (r<10)
arr[i] = r + 48;
else
arr[i] = r + 55;
temp = temp / 16;
}
int j;
printf("\nhex of %d is ", n);
for (j = i - 1; j >= 0; j--)
... |
C | /*
* Calling C code from go
*
* Go provides a pseudo package called C to interface with C libraries.
* Its not very straightforward how to do this though.
* In this tutorial, well go over creating a simple C function,
* and calling it from go. After that, well move on to a slightly
* more complex example involvi... |
C | #include <nc_tests.h>
#include "err_macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>
#define FILECLASSIC "tst_dimsize_classic.nc"
#define FILE64OFFSET "tst_dimsize_64offset.nc"
#define FILE64DATA "tst_dimsize_64data.nc"
#define DIMMAXCLASSIC (NC_MAX_INT - 3)
#define DIMMAX64OFFSET (NC_MAX_UINT - 3... |
C | #include <stdio.h>
int main(void)
{
int row, line, space, num;
printf("Enter the number of row to print the number pyramid pattern: ");
scanf("%d", &row);
for (line = 1; line <= row; line++)
{
for(num = 1; num <= line; num++)
printf("%d", num);
for(space = 1; sp... |
C | #include<stdio.h>
#include<conio.h>
void main(int argc,char *argv[])
{
FILE *fp,*f1;
char c,s[10];
int i;
clrscr();
f1=fopen("real","w");
for(i=0;i<argc;i++)
fprintf(f1,"%s ",argv[i]);
fclose(f1);
f1=fopen("real","r");
fp=fopen("copy","w");
for(i=0;i<argc;i++)
{
fscanf(f1,"%s",s);
fprintf(fp,"%s ",s);
}
fclose(f1);
fcl... |
C | #include "helloLib.h"
#include <stdio.h>
void printResult(int res)
{
printf("The result is: %d.\n", res);
}
int addNumbers(int a, int b)
{
return a+b;
}
void printFirstNumber(int num)
{
printf("The first number is: %d.\n", num);
}
void printSecondNumber(int num)
{
printf("The second number is: %d.\n", num);
}
|
C | #include <stdio.h>
int main()
{
int A[100][100];
int B[100][100];
int N, M;
int N2, M2;
//L� as dimens�es de cada matriz
printf("Dimensoes Matriz A, separadas por espaco: \n");
scanf("%d %d", &N, &M);
printf("Dimensoes Matriz B, separadas por espaco: \n");
scanf("%d %d", &N2, &M2);
... |
C | #include "help.h"
int is_nat(char* a)
{
int n = strlen(a), num = 0, sign, i = 0;
if(a[0] == '-' || a[0] == '+')
i = 1;
else
if(!(a[0] > '0' && a[0] < '9'))
return -1;
for(;i < n;i++)
{
if(!(a[i] >= '0' && a[i] <= '9'))
return -1;
if(num >= 20... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* perebor.c :+: :+: :+: ... |
C | #include<stdio.h>
int main(){
float a1,b1,a2,b2,X,Y;
scanf("%f%f%f%f",&a1,&b1,&a2,&b2);
if ((a1/a2)==b1/b2)
{
printf("INF");
}
else
{
Y=(a2-a1)/(a2*b1-b2*a1);
X=(b2-b1)/(b2*a1-b1*a2);
printf("(%.3f,%.3f)",X,Y);
}
return 0;
} |
C | #include "bilist.h"
int main()
{
struct node head;
list_create(&head,10);
list_operation(&head,node_show);
printf("\n");
node_insert1(&head,20);
list_operation(&head,node_show);
printf("\n");
list_reverse(&head);
list_operation(&head,node_show);
printf("\n");
list_operation(&head,node_free);
list_operation... |
C | //copied from private directory
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<sys/wait.h>
#include<fcntl.h>
#define DELIMITERS " \t\r\n\a"
int numRedirect = 0;
//method declearations
int execute(char* args[], char* retArgs[]);
//path for binary files
typedef struct Node {
... |
C | #include <stdio.h>
int main(){
float peso, altura, imc;
printf("Digite o peso: ");
scanf("%f", &peso);
printf("\nDigite o altura em metros: ");
scanf("%f", &altura);
imc = peso / (altura * altura);
printf("\nPeso: %.2f", peso);
printf("\nAltura: %.2f", altura);
printf("\nIMC: %.2f", imc);
... |
C | // Data_transfer takes two SSL objects as params, which are expected to have
// connection to two different peers.
// Data_transfer will read data from A and write it to B, and at the same time
// read data from B and write it to A.
// Three functions that are not explicitly defined:
// 1. set_nonblocking(SSL *) must ... |
C | /*
* @file malloc.c
* @brief thread-safe mallocs.
* @author Yue Xing(yuexing)
* @bug No Found Bug.
*/
#include <libthread.h>
/**
* @brief sync machanism.
*/
static mutex_t lock = MUTEX_INIT;
void *malloc(size_t __size)
{
void *ret;
mutex_lock(&lock);
ret = _malloc(__size);
mutex_unlock(&lock);
return re... |
C | /* Ex. 1-16 (p. 30): Edit the __main routine__ to correctly print the
* length of arbitrarly long input lines and as much as __possible__
* of the longest line. That is, we are not to modify copy and getline
* routines. */
#include <stdio.h>
#include <string.h>
#define MAXLINE 10 /* maximum input line size */
/*... |
C | #include "ft_ls.h"
void invalid_flag(char *str)
{
ft_putstr("ft_ls: invalid option -- '");
ft_putchar(str[0]);
ft_putstr("'\nft_ls options are: [-aRrt] [path...]\n");
exit(0);
}
void invalid_folder(char *str)
{
ft_putstr("ft_ls: cannot access '");
ft_putstr(str);
ft_putendl("' : No such file or directory");
e... |
C | #include <stdio.h>
#include "stuff.h"
int main() {
/* array */
Thing * things;
things = initThings(3);
setAX(things, 1, 9);
int n = -1;
n = getAX(things, 1);
printf("%d\n", n);
/* singleton */
Thing * t;
t = initThing();
int r = -1;
setX(t, 8);
r = getX(t);
printf("%d\n", r);
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <float.h>
typedef struct node
{
struct node* children;
struct node* brother;
char * nodeType;
char * value;
char * annotate;
int nline;
int ncol;
}node;
typedef struct token
{
char * value;
int nline;
int ncol;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "LinkedlistComp.h"
int main(){
int student_count,i,*x,k;
Student* student_dynamic_array;
Student* newStudent;
SLLI* head =NULL;
printf("How many students will be registered for this course : ");
scanf("%d", &studen... |
C | #include<stdio.h>
int main(){
double a,c,e;
int b;
printf("请输入你的税前收入\n");
scanf("%lf",&a);
c=a-3500;
b=1*(c<0)+2*(0<=c&&c<1500)+3*(1500<=c&&c<4500)+4*(4500<=c&&c<9000)+5*(9000<=c&&c<35000)+6*(35000<=c&&c<55000)+7*(55000<=c&&c<80000)+8*(80000<=c);
switch(b){
case 1:
printf("0");
break;
case 2:
e=... |
C | // to check whether given number is a pallinderome or not using while loop
#include <stdio.h>
int main() {
int n, rev = 0, r, num;
printf("enter the number \n");
scanf("%d", &n);
num = n;
while (n != 0) {
r = n % 10;
rev = rev * 10 + r;
n = n / 10;
}
if (num == rev) {
printf("the number... |
C | #include "test_rbfunc.h"
#include "rbfunc.h"
#include "qsyst.h"
#include <stdio.h>
#include <stdlib.h>
void test_rbfunc()
{
int num_test_passed = 0;
//Test 1
int output = bvar_number_of_values(11, 5);
int expected = 1024;
if (output == expected)
{
num_test_passed += 1;
}
//Tes... |
C | #include <stdio.h>
int Modulo(int param, int param2){
return param % param2;
}
int Divide(int param, int param2){
return param / param2;
}
int Multiply(int param, int param2){
return param * param2;
}
int Sum(int param, int param2){
return param + param2;
}
int main()
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.